<template>
  <div>
    <div class="text-2xl text-fuchsia">角色管理页面</div>

    <el-button type="primary" @click="click(1)">请求</el-button>
    <el-button type="primary" @click="click(2)">请求List</el-button>
    <el-button type="primary" @click="click(3)">请求路由</el-button>

    <div>请求返回值:</div>
    <div>{{ data }}</div>

    <el-rate v-model="value" :colors="colors"></el-rate>

    <el-button type="primary" @click="back()">返回</el-button>
  </div>
</template>
<script setup lang="ts" name="Role">
import TestApi from '@/api/test'
import MenuApi from '@/api/module/system/menu'
const router = useRouter()
const value = ref(0)
const colors = ref(['#99A9BF', '#F7BA2A', '#FF9900'])

const data = ref()
const click = (val: number) => {
  if (val === 1) {
    TestApi.getInfo().then(res => {
      data.value = res
    })
    return
  }
  if (val === 3) {
    MenuApi.getRouters().then(res => {
      data.value = res
    })
    return
  }
  TestApi.getList().then(res => {
    data.value = res
  })
}
const back = () => {
  router.push({ path: '/' })
}
</script>
